package main

import "fmt"

type FluxD struct {
	name  string
	age   int
	Hobby []string
	map1  map[string]string
}

func main() {
	var p1 FluxD
	p1.name = "A"
	p1.age = 18
	//fmt.Println(p1.Hobby[0]) // panic: runtime error: index out of range [0] with length 0
	p1.Hobby = make([]string, 0, 10)
	p1.Hobby = append(p1.Hobby, "吃饭", "睡觉", "打豆豆") // // 自动分配内存
	p1.map1 = make(map[string]string)              //panic: assignment to entry in nil map
	p1.map1["a"] = "1"
	p1.map1["b"] = "2"
	p1.map1["c"] = "3"

	fmt.Println(p1)

}
